package test3;

import org.codehaus.xfire.client.Client;
import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;
import org.codehaus.xfire.transport.Channel;

public class Main {

	public static void main(String[] args) throws Exception{
		String serviceURL = "http://localhost:8080/remoting/testService.ws";
		
		//ApplicationContext context = new ClassPathXmlApplicationContext("test3/beans.xml");
		//TestService m = (TestService)context.getBean("testService");
		
		
		Service serviceModel = new ObjectServiceFactory().create(TestService.class);
		TestService m = (TestService) new XFireProxyFactory().create(serviceModel, serviceURL);
		Client client = Client.getInstance(m);
		client.setProperty(Channel.USERNAME, "rpc");
		client.setProperty(Channel.PASSWORD, "123456");
		
		System.out.println(m.add(5, 7));
	}

}
